package net.maku.project.service.impl;

import lombok.AllArgsConstructor;
import net.maku.framework.mybatis.service.impl.BaseServiceImpl;
import net.maku.project.dao.InfoDao;
import net.maku.project.entity.InfoEntity;
import net.maku.project.service.ProjectDetailService;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.Collection;

@Service
@AllArgsConstructor
public class ProjectDetailServiceImpl extends BaseServiceImpl<InfoDao, InfoEntity> implements ProjectDetailService {

    // 更新项目信息表的阶段状态
    @Override
    public void updateProjectCurrentStatus(Long projectId, String statusName) {
        InfoEntity project = new InfoEntity();
        project.setId(projectId);
        project.setCurrentStatus(statusName);
        updateById(project);
    }

    //更新项目结束时间
    @Override
    public void updateProjectEndDate(Long projectId){
        InfoEntity project = new InfoEntity();
        project.setId(projectId);
        project.setEndTime(LocalDateTime.now());
        project.setCurrentStatus("已完成");
        updateById(project);
    }

    @Override
    public boolean save(InfoEntity entity) {
        return ProjectDetailService.super.save(entity);
    }

    @Override
    public boolean saveBatch(Collection<InfoEntity> entityList) {
        return ProjectDetailService.super.saveBatch(entityList);
    }


    @Override
    public boolean saveOrUpdateBatch(Collection<InfoEntity> entityList) {
        return ProjectDetailService.super.saveOrUpdateBatch(entityList);
    }

}
